﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="List.cs" company="HelloWorld">
//   BY王悉奥
// </copyright>
// <summary>
//   Defines the UserControl2 type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace WindowsFormsApp2.Control
{
    using System.Windows.Forms;

    using WindowsFormsApp2.Service;

    /// <summary>
    /// The user control 2.
    /// </summary>
    public partial class List : UserControl
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="List"/> class.
        /// </summary>
        public List()
        {
            this.InitializeComponent();
        }

        /// <summary>
        /// The user control 2_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void UserControl2_Load(object sender, System.EventArgs e)
        {
            var lists = DeadlineService.SelectAll();
            this.dgv_list.Rows.Clear();
            foreach (var list in lists)
            {
                object[] listObjects = { list.Course, list.Information, list.DeadlineTime };
                this.dgv_list.Rows.Add(listObjects);
            }
        }
    }
}
